// 审批流程相关API - 核心功能
import { request } from '@/utils/request.js'

/**
 * 获取待审批列表
 */
export function queryUserFlow(userName) {
	return request({
		url: '/flowable-server/workflow/queryUserFlow',
		method: 'POST',
		params: { userName }
	})
}

/**
 * 专门查询投诉相关的任务，包含完整的分类信息
 */
export function queryComplaintTasks(userName) {
	return request({
		url: '/flowable-server/workflow/queryComplaintTasks',
		method: 'POST',
		params: { userName }
	})
}

/**
 * 查询用户已完成任务
 */
export function queryCompletedTasks(userName) {
	return request({
		url: '/flowable-server/workflow/queryCompletedTasks',
		method: 'POST',
		params: { userName }
	})
}

/**
 * 审批通过
 */
export function approveProcess(taskId) {
	return request({
		url: '/flowable-server/workflow/acceptFlow',
		method: 'POST',
		params: { taskId }
	})
}

/**
 * 审批驳回
 */
export function rejectProcess(taskId, reason) {	
	return request({
		url: '/flowable-server/workflow/rejectFlow',
		method: 'POST',
		params: { taskId, reason }
	})
}


/**
 * 获取审批统计信息
 */
export function getApprovalStatistics(userName) {
	return request({
		url: '/flowable-server/workflow/approvalStatistics',
		method: 'POST',
		params: { userName }
	})
}

